home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2563 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: khyber.ncc.up.pt!usenet
  2. From: Luis Miguel Pinho <lmp@tormentas.fe.up.pt>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: question on pass-by-reference
  5. Date: Mon, 22 Jan 1996 15:03:24 +0000
  6. Organization: ISR-GAI
  7. Message-ID: <3103A73C.41C6@tormentas.fe.up.pt>
  8. References: <4dha4j$4qg@shrike.depaul.edu>
  9. NNTP-Posting-Host: tormentas.fe.up.pt
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b3 (X11; I; AIX 2)
  14.  
  15. Kazuki Murakami wrote:
  16. > I have a question on pass-by-reference.
  17. > Here is a problem, I want to set array of unsigned short number to be all 0 using a function.
  18. > here is what set looks like:
  19. >         typedef unsigned short USHORT;
  20. >         typedef  USHORT SET[32];
  21. > here is the setInit, which will initialize set to be 0,
  22. >         void setInit (SET *s)
  23. >         {
  24. >             int i;
  25. >             for (i=0; i<32; i++)
  26. >             {
  27. >                 *s[i] = 0;
  28.         ^^^^^^^^^^^^^^
  29.     try      (*s)[i]=0;
  30. >             }
  31. >         }
  32. > here is the calling function.
  33. >         setInit(&set1);  setInit(&set2);
  34.     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  35.     first you have to define:
  36.     SET set1,set2;
  37.  
  38. > I think there is somthing wrong in "setInit" function but I cannot seem to figure out what that is.
  39. > If somebody can figure out what that is or some other way of initializing "SET s" please give
  40. > me a e-mail.
  41. > e-mail address is kmurakam@shrike.edpaul.edu
  42. > Thank you
  43. > Kazuki Murakami
  44.  
  45. -- 
  46. **********************************************************************
  47. Luis Miguel Pinho            Tel: 351-2-5502372
  48. Largo da Lapa, 14, 2oE                 351-2-2041815    
  49. 4050 Porto                 http://tormentas.fe.up.pt/lmp    
  50. Portugal                 E-mail: lmp@tormentas.fe.up.pt
  51. **********************************************************************
  52.